// Decompiled by GOOSIN CO,LTD Copyright 2010 Pavel Kouznetsov.
// home page: http://www.Goosin.net
// Decompiler options: packimports(3) fieldsfirst ansi space 
// Source File Name:   copyFile.java

package include.nseer_cookie;

import java.io.*;

public class copyFile
{

	String sourcePath;
	String destinationPath;
	int buffer;
	long fileLength;
	FileInputStream sourceFile;
	FileOutputStream destinationFile;
	boolean makeDirs;
	boolean isMoving;
	boolean fieldSss;

	public copyFile(String sourcePath, String destinationPath)
	{
		this.sourcePath = sourcePath;
		this.destinationPath = destinationPath;
		buffer = 2048;
		fileLength = 0L;
		sourceFile = null;
		destinationFile = null;
		makeDirs = false;
		isMoving = false;
		fieldSss = false;
	}

	public int copy()
	{
		File sourceFile;
		File destFile;
		File destinationFile;
		byte buf[];
		sourceFile = new File(sourcePath);
		destFile = new File(destinationPath);
		destinationFile = null;
		FileInputStream sourceFileInputStream = null;
		FileOutputStream destinationFileOutputStream = null;
		buf = new byte[buffer];
		int counter = 0;
		if (!sourceFile.exists())
			return -1;
		if (sourceFile.isDirectory())
			return -2;
		if (!destFile.isDirectory()) goto _L2; else goto _L1
_L1:
		String srcName = sourceFile.getName();
		this;
		destinationPath;
		JVM INSTR new #66  <Class StringBuilder>;
		JVM INSTR dup_x1 ;
		JVM INSTR swap ;
		String.valueOf();
		StringBuilder();
		srcName;
		append();
		toString();
		destinationPath;
_L2:
		File parentDirFile;
		destinationFile = new File(destinationPath);
		String parentDirectory = destinationFile.getParent();
		parentDirFile = new File(parentDirectory);
		if (!parentDirFile.exists())
		{
			if (!makeDirs)
				return -3;
			try
			{
				if (makeDirs)
					parentDirFile.mkdirs();
			}
			catch (NullPointerException nullpointerexception) { }
		}
		long oldFileLength = fileLength;
		fileLength = sourceFile.length();
		FileInputStream sourceFileInputStream;
		FileOutputStream destinationFileOutputStream;
		try
		{
			sourceFileInputStream = new FileInputStream(sourceFile);
			destinationFileOutputStream = new FileOutputStream(destinationFile);
			int counter;
			while ((counter = sourceFileInputStream.read(buf)) != -1) 
				destinationFileOutputStream.write(buf, 0, counter);
		}
		catch (IOException e)
		{
			return -4;
		}
		if (destinationFileOutputStream != null)
			try
			{
				destinationFileOutputStream.close();
			}
			catch (IOException e)
			{
				return -4;
			}
		try
		{
			sourceFileInputStream.close();
		}
		catch (IOException e)
		{
			return -4;
		}
		return 1;
	}

	public void setMakeDirs(boolean makeDirs)
	{
		boolean oldValue = this.makeDirs;
		this.makeDirs = makeDirs;
	}

	public static void main(String args[])
	{
		copyFile cp = new copyFile("d:/cnbbs/face/face0.gif", "d:/gggggg/crm.gif");
		cp.setMakeDirs(false);
		cp.copy();
	}
}
